

def process(path_file, isSpace=True):
    '''
        预处理csv文件，主要是把空格转逗号
    :param path_file:
    :param isSpace:
    :return:
    '''
    read_file = open(path_file, 'r')
    strs = read_file.readlines()
    read_file.close()

    pro_strs = []
    for str in strs:
        tmp = str.replace("   ", ",")
        tmp = tmp.replace("  ", ",")
        tmp = tmp.replace(" ", ",")

        if isSpace:
            tmp = tmp[1::]

        pro_strs.append(tmp)

    write_file = open(path_file, 'w')
    write_file.writelines(pro_strs)


path_file = r"data/data_final2/dv.csv"
process(path_file, True)

path_file = r"data/data_final2/fc.csv"
process(path_file, False)
